package org.whuims.pois.dao;

import org.whuims.pois.hibernate.BaseDao;
import org.whuims.pois.model.Wordlist;
import java.util.List;

/**
 * @author herochen
 * @date 2010-4-20 @time 下午09:25:39
 */
public class KeywordDao {

    BaseDao baseDao = new BaseDao();
    public List<Wordlist> list(long topicId) {
        List<Wordlist> list =baseDao.findByParamsArr("from Wordlist where topicid = ?",topicId);
        return list;
    }



    /**
     * 查找某个关键词对应的对象
     */
    public Wordlist select(Long id) {
        Wordlist bean = (Wordlist)baseDao.getByPk(Wordlist.class, id);
        return bean;
    }

    public void insert(Wordlist bean) {
        baseDao.create(bean);
    }

    public void delete(Wordlist bean) {
        baseDao.delete(bean);
    }

    public void modify(Wordlist bean) {
//        baseDao.excuteSql("update Wordlist set keyword = '" + bean.getKeyword()
//                + "', importance = " + bean.getImportance() + ", category = '"
//                + bean.getCategory() + "', topicid = '"+bean.getTopicid()+"' where id = '" + bean.getId() + "'");
        baseDao.update(bean);
    }

}
